<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>pyctags</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pyctags">pyctags</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;pyctags
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="pyctags-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package pyctags</h1><p class="nomargin-top"><span class="codelink"><a href="pyctags-pysrc.html">source&nbsp;code</a></span></p>
<p>A ctags file reader and a wrapper to the command line program 
  ctags.</p>
  <p>This package has been tested against exuberant ctags version 5.7 and 
  SVN revision 686 on Windows XP and Linux with Python 2.5 and 2.6.</p>
  <p><b>Security Notes:</b></p>
  <ul>
    <li>
      This package makes use of the subprocess.Popen() and eval() python 
      constructs.
    </li>
    <li>
      This package <b>does not</b> filter the parameters for security, 
      instead relying on module users to implement relevant security for 
      their applications.
    </li>
  </ul>
  <p>Included in the source distribution is an example of usage and several
  tests that can illustrate usage.</p>
  <p>Here's a very small sample to show it in action:</p>
<pre class="literalblock">
   from pyctags import exuberant_ctags, ctags_file

   # if you have a list of source files:
   ctags = exuberant_ctags()

   # the module will default to running whichever ctags is on the path, if it can
   taglist = ctags.generate_tags(files=['path/to/source.h'])
   
   # or you can specify a path
   taglist = ctags.generate(tag_program='/opt/bin/ctags', files=['/path/to/source.h', '/path/to/different/source.py', '../also/here.c'])
   
   # pass additional flags to exuberant ctags (file list stored from previous run or constructor)
   taglist = ctags.generate_tags(generator_options={'--fields' : '+imn', '-F' : None}

   # you can generate a tag file instead
   ctags.generate_tagfile(output_file_path, generator_options={'--fields' : '+imn'}, file_list=['../some_dir/src.s'])
   
   # a few ways to parse into a ctags_file object
   tagfile = ctags_file(taglist)
   
   # or, if you already have a tags file:
   tagfile = ctags_file(&quot;/path/to/tagfile&quot;)
   
   # or from a list
   file_lines = open(&quot;/path/to/tagfile&quot;).readlines()
   tagfile = ctags_file(file_lines)

   # you can also do it this way
   tagfile = ctags_file()
   tagfile.parse(file_lines)
   
   # clears data from file_lines
   tagfile.parse(&quot;/path/to/tagfile&quot;)
   
   print len(tagfile) # number of tags

   f_tags = tagfile.starts_with('f', case_sensitive=True) # print all tags that start with a lower case f

   first_tag = tagfile[0]

   for tag in tagfile:
       print tag

   taglist = tagfile['tagname'] # list of tags that match tagname

   for tag in taglist:
       print tag.name
       print tag.line_number
       print tag.pattern
       print tag.extensions
</pre>
  <p>I'm not certain if ctags generators other than Exuberant Ctags are in 
  much use, but wrappers for them can be derived from ctags_base.py. Feel 
  free to contact me for or with details.</p>
  <p>Pyctags is currently unsuitable for extremely large projects.  I've 
  used it to generate a custom kernel source tag file that came out to 153 
  MB, generation worked fine but I had to kill the tag parser - it was 
  soaking up an enormous amount of RAM.  The kernel source is a very large 
  data set to represent all of in memory at once in python, though I'm 
  hoping there are things I can do to address this.  Things will work fine 
  on smaller projects than the Linux kernel, depending on the amount of 
  system memory available.</p>

<!-- ==================== SUBMODULES ==================== -->
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Submodules</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Submodules"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr><td class="summary">
  <ul class="nomargin">
    <li> <strong class="uidlink"><a href="pyctags.ctags_base-module.html">pyctags.ctags_base</a></strong>: <em class="summary">Base class for wrappers around ctags programs.</em>    </li>
    <li> <strong class="uidlink"><a href="pyctags.exuberant-module.html">pyctags.exuberant</a></strong>: <em class="summary">Exuberant Ctags (<a href="http://ctags.sourceforge.net" 
        target="_top">http://ctags.sourceforge.net</a>) wrapper.</em>    </li>
    <li> <strong class="uidlink"><a href="pyctags.kwargs_validator-module.html">pyctags.kwargs_validator</a></strong>: <em class="summary">A simple validator to make sure keyword arguments are valid.</em>    </li>
    <li> <strong class="uidlink"><a href="pyctags.readtags-module.html">pyctags.readtags</a></strong>: <em class="summary">Python representation of ctags format file and data elements in the
        file.</em>    </li>
  </ul></td></tr>
</table>

<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/pyctags">pyctags</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sat Dec 13 17:38:36 2008
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
